readNexus
reads a Nexus file and outputs a phylo4
or
phylo4d
or data.frame
object.
readNewick
reads a Newick file and outputs a phylo4
or
phylo4d
object.readNexus(file, simplify=FALSE, type=c("all", "tree", "data"),
char.all=FALSE, polymorphic.convert=TRUE, levels.uniform=FALSE,
quiet=TRUE, check.node.labels=c("keep", "drop", "asdata"),
return.labels=TRUE, check.names=TRUE, convert.edge.length=FALSE,
...)readNewick(file, simplify=FALSE, quiet=TRUE,
check.node.labels=c("keep", "drop", "asdata"),
convert.edge.length=FALSE, ...)
readNexus
or a file that contains
Newick formatted trees for readNewick
phylobase
does not
accept objects with negative branch lengths, this workaround allows
to still use trees with negative branch lengths are atype
and the contents of the file,
one of: a data.frame
, a NULL
.
If several trees are included in the Nexus file and the option
simplify=FALSE
a list of readNexus
extracts data held in a Nexus file, specifically from
DATA, CHARACTER or TREES blocks present in the file. The type
argument specifies which of these is returned:
[object Object],[object Object],[object Object]
The function returns NULL
if the type
of data requested is
not present in the file, or if neither data nor tree blocks are present. Depending on the context readNexus
will call either the
phylo4
or phylo4d
constructor. In addition with
type="all"
, the phylo4d
constructor will be used if
check.node.labels="asdata"
.
readNewick
imports newick formatted tree files and will return a
phylo4
or a phylo4d
object if the option
check.node.labels="asdata"
is invoked.
For both readNexus
and readNewick
, the options for
check.node.labels
can take the values:
[object Object],[object Object],[object Object]
If you use the option asdata
on a file with no node labels, a
warning message is issued, and thus check.node.labels
takes
the value drop
.
For both readNexus
and readNewick
, additional arguments
can be passed to the constructors such as annote
,
missing.data
or extra.data
. See the documentation of
phylo4-methods, phylo4d and formatData for the
complete list of options.